
public class LRUTest {
	
	public static void main(String[] args) {
		LRU lru = new LRU(3);
		boolean insert = true;
		for(int i = 1; i < 50; i++) {
			int random = (int) (Math.random() * 5 + 1);
			System.out.println((insert ? "插入:" : "获取:") + random);
			if(insert) {
				lru.setValue(random);
			}else {
				lru.getValue(random);
			}
			showNode(lru.head);
			insert = !insert;
		}
		
	}

	private static void showNode(DoubleNode head) {
		DoubleNode tmp = head;
		while (tmp != null) {
			System.out.print(tmp.value + "->");
			tmp = tmp.next;
		}
		System.out.println();
	}

}
